
import java.awt.Color;
import java.awt.Component;
import java.awt.Graphics;
import java.awt.Graphics2D;
import java.awt.Paint;
import java.awt.RenderingHints;
import java.awt.geom.RoundRectangle2D;
import javax.swing.Icon;

/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

/**
 *
 * @author Dark_Wolf
 */
public class CloseIcon implements Icon{
     int height;
     int width;
     
     public CloseIcon(int height, int width){
         this.height=height;
         this.width=width;
         
     }
        

    public void paintIcon(Component c, Graphics g, int x, int y) {
           double arc = Math.PI/4;
          Graphics2D g2 = (Graphics2D) g;
            g2.setRenderingHint(RenderingHints.KEY_ANTIALIASING,
                    RenderingHints.VALUE_ANTIALIAS_ON);
            
            
            g2.translate(x,y);
            g2.rotate(arc);
            Paint paint = g2.getPaint();
            RoundRectangle2D button = new RoundRectangle2D.Double(0, 0, width/Math.cos(arc), height/5, height / 5, height / 5);
           
            g2.setColor(new Color(255,255,255,200));
            
            g2.fill(button);
            
            g2.rotate(-arc);
            g2.translate(-height/(10*Math.sin(arc)), width/(Math.cos(arc)*Math.sqrt(2)));
           g2.rotate(-arc);
            //g2.translate(-height/5,0);
            g2.fill(button);
            g2.rotate(arc);
            //g2.translate(-x-width/2, -y-height/2);
         
            
            //g2.setPaint(new GradientPaint(0, 10, new Color(0x000000), 0, 17, new Color(0xf0f0f0), true));

            

            g2.setPaint(paint);
    }

    public int getIconWidth() {
       return width;
    }

    public int getIconHeight() {
       return height;
    }

}
